<template>
    <van-row>
        <van-col span="6">
            <van-sidebar v-model="active">
                <van-sidebar-item v-for="item in categoriesAPiData" :title="item.cat_name" />
            </van-sidebar>
        </van-col>
        <van-col span="18">
            <div v-for="item in categoriesAPiData[active]?.children">
                <h4>{{ item.cat_name }}</h4>
                <van-grid :border="false" :column-num="4">
                    <van-grid-item v-for="item in item.children">
                        <router-link :to="'/lb/' + item.cat_name">

                            <van-image :src="item.cat_icon" />
                            <h4>{{ item.cat_name }}</h4>
                        </router-link>

                    </van-grid-item>
                </van-grid>
            </div>
        </van-col>
    </van-row>
</template>

<script setup>
import { categoriesAPi } from '@/api/api'
import { ref } from 'vue';
const categoriesAPiData = ref([])
categoriesAPi().then(res => {
    console.log('分类数据', res);
    categoriesAPiData.value = res.data.message
})
const active = ref(0);
</script>

<style lang="scss" scoped></style>